#CalBMIv3.py
y_or_n = input ("是否退出程序（输入y/n）：")
while y_or_n != 'y' :
    print ("请输入信息，并以空格分开")
    input_str=input("身高(米) 体重(公斤) 年龄 性别[男or女]:")
    str_list = input_str.split(' ')#注意打个空格
    height= float(str_list[0])
    weight= float(str_list[1])
    age= int(str_list[2])
    gender = str_list[3]
    bmi = weight / pow(height, 2)
    print("BMI 数值为：{:.2f}".format(bmi))
    if gender == "男":
        BMR = (13.7 * weight) + (5.0 * height) - (6.8 * age) + 66
        print("BMR 数值为：{:.2f}".format(BMR))
    elif gender == "女":
        BMR = (9.6 * weight) + (1.8 * height) - (4.7 * age) + 655
        print("基础代谢率：{:.2f}大卡".format(BMR))
    else:
        print("暂不支持此性别！")
    who, nat = "", ""
    if bmi < 18.5:
        who, nat = "偏瘦", "偏瘦"
    elif 18.5 <= bmi < 24:
        who, nat = "正常", "正常"
    elif 24 <= bmi < 25:
        who, nat = "正常", "偏胖"
    elif 25 <= bmi < 28:
        who, nat = "偏胖", "偏胖"
    elif 28 <= bmi < 30:
        who, nat = "偏胖", "肥胖"
    else:
        who, nat = "肥胖", "肥胖"
    print("BMI 指标为:国际'{0}', 国内'{1}'".format(who, nat))
    print()
    y_or_n = input("是否退出程序（输入y/n）：")
